#ifndef _ILI9327_H
#define _ILI9327_H

#ifdef __cplusplus
extern "C" {
#endif

#include "main.h"

/*Color depth: 8 (A8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/
#define ILI9327_COLOR_DEPTH 16

#if ILI9327_COLOR_DEPTH == 16
#define COLOR_R (0x1f<<(11))
#define COLOR_G (0x3f<<(5))
#define COLOR_B (0x1f<<(0))
#else
#define COLOR_R (0x3f<<(2+16))
#define COLOR_G (0x3f<<(2+8))
#define COLOR_B (0x3f<<(2+0))
#endif

#define TRANSPARENT (0xff000000UL)


#define BLACK   (0)
#define WHITE   (COLOR_R|COLOR_G|COLOR_B)
#define RED     (COLOR_R)
#define GREEN   (COLOR_G)
#define BLUE    (COLOR_B)
#define YELLOW  (COLOR_R|COLOR_G)
#define PURPLE  (COLOR_R|COLOR_B)
#define CYAN    (COLOR_G|COLOR_B)

typedef struct
{
    __OM  uint16_t CMD;
    __IOM uint16_t DAT;
} ILI9327_TypeDef;

#define ILI9327 ((ILI9327_TypeDef *)0x6C00007E)

void ILI9327_Init(void);

void ILI9327_Set_Window(size_t sx, size_t sy, size_t ex, size_t ey);
void ILI9327_DrawPoint(size_t x, size_t y, uint32_t color);


#ifdef __cplusplus
}
#endif

#endif // _ILI9327_H
